package com.zzx.controller;

import com.zzx.entity.ApiResult;
import com.zzx.entity.TProductOrderProduct;
import com.zzx.service.TProductOrderProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "产品单-产品 模块管理")
@RestController
@RequestMapping("/TProductOrderProduct")
public class TProductOrderProductController {

    @Resource
    private TProductOrderProductService tProductOrderProductService;

    @ApiOperation(value = "新增、编辑")
    @RequestMapping(value="/add",method = RequestMethod.POST)
    public ApiResult add(@RequestBody TProductOrderProduct param) {
        tProductOrderProductService.add(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "批量-新增、编辑")
    @RequestMapping(value="/addList",method = RequestMethod.POST)
    public ApiResult addList(@RequestBody List<TProductOrderProduct> param) {
        tProductOrderProductService.addList(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "删除")
    @RequestMapping(value="/deleteById",method = RequestMethod.POST)
    public ApiResult deleteById(@RequestBody TProductOrderProduct param) {
        tProductOrderProductService.deleteById(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "列表查询")
    @RequestMapping(value="/selectBy",method = RequestMethod.POST)
    public ApiResult selectBy(TProductOrderProduct param) {

        return ApiResult.ok(tProductOrderProductService.selectBy(param));
    }

    @ApiOperation(value = "更新产品单-产品 状态")
    @RequestMapping(value="/updateStaus",method = RequestMethod.POST)
    public ApiResult updateStaus(TProductOrderProduct param) {
        tProductOrderProductService.updateStaus(param);
        return ApiResult.ok();
    }
}
